package com.gin.supermarket_inventory_system.inventory.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gin.database.base.BasePo;
import com.gin.supermarket_inventory_system.inventory.enums.InventoryReceiptType;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.Comment;

/**
 * 库存数量变动单据
 * @since : 2023/10/11 11:14
 * @author : ginstone
 * @version : v1.0.0
 **/
@Getter
@Setter
@TableName(value = InventoryReceiptPo.TABLE_NAME, autoResultMap = true)
@Entity(name = InventoryReceiptPo.TABLE_NAME)
@NoArgsConstructor
@Table
public class InventoryReceiptPo extends BasePo {
    protected static final String TABLE_NAME = "tb_inventory_entity_receipt";

    @Column(nullable = false)
    @Enumerated(EnumType.STRING)
    @Comment("单据类型")
    InventoryReceiptType type;

    @Column
    @Comment("供应商ID")
    Long purveyorId;

    @Column(nullable = false, scale = 2)
    @Comment("总价")
    double totalPrice;


    @Column(length = 1000)
    @Comment("备注")
    String remark;

    @Column
    @Comment("操作人用户ID")
    long userId;

    /**
     * 日期，非表字段
     */
    @Transient
    @TableField(exist = false)
    String date;
}